package com.chinacoal.microservice;

import com.chinacoal.microservice.fallback.CurrencyClientFallback;
import com.chinacoal.microservice.pojo.*;
import com.chinacoal.microservice.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignAutoConfiguration;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author zhuliang
 * @version V1.0
 * @Description: 通用接口
 * @date 2020-11-17 17：55
 */
@Api(tags = {"通用接口"})
@FeignClient(name = "${spring.application.name}",fallback = CurrencyClientFallback.class,configuration = FeignAutoConfiguration.class)
public interface CurrencyClient {

    /**
     * @Description: 中台登录接口
     * @author zhuliang
     * @date 2020/11/17 18:05
     */
    @ApiOperation(value = "中台登录接口")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "body", name = "currency", value = "通用实体类", required = true, dataType = "Currency")
    })
    @PostMapping("smartleasing/currency/getLoginPerson")
    public Result getLoginPerson(@RequestHeader("token") String token, @RequestBody Currency currency);

    /**
     * @Description: 总登录接口
     * @author zhuliang
     * @date 2021/1/25 11:03
     */
    @ApiOperation(value = "总登录接口")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "currency", value = "通用实体类", required = true, dataType = "Currency")
    })
    @PostMapping("smartleasing/currency/adminLogin")
    public Result<String> adminLogin(@RequestBody Currency currency);

    /**
     * @Description: 注销登录
     * @author zhuliang
     * @date 2021/1/14 11:49
     */
    @ApiOperation(value = "注销登录")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @GetMapping("smartleasing/currency/logout")
    public Result logout(@RequestHeader("token") String token);

    /**
     * @Description: 根据对应的父类id查询对应的子类信息（省，市，区，街道）
     * @author zhuliang
     * @date 2020/11/19 9:13
     */
    @ApiOperation(value = "根据对应的父类id查询对应的子类信息（省，市，区，街道）")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", name = "parentid", value = "父类id", required = true, dataType = "Integer")
    })
    @GetMapping("smartleasing/currency/parentIdList/{parentid}")
    public Result<List<CcmsSmartleasingArea>> getParentIdList(@PathVariable(value = "parentid") Integer parentid);

    /**
     * @Description: 查询楼宇模块所有的下拉框数据
     * @author zhuliang
     * @date 2020/11/30 20:45
     */
    @ApiOperation(value = "查询楼宇模块所有的下拉框数据")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @GetMapping("smartleasing/currency/getAllByBuilding")
    public Result<CcmsSmartleasingBasicdata> getAllByBuilding(@RequestHeader("token") String token);

    /**
     * @Description: 根据一级关联id查询二级信息
     * @author zhuliang
     * @date 2020/11/30 20:47
     */
    @ApiOperation(value = "根据一级主键id查询二级信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", name = "itemId", value = "一级主键id", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @GetMapping("smartleasing/currency/getAllByTwo/{id}")
    public Result<List<CcmsSmartleasingBasicdata>> getAllByTwo(@PathVariable(value = "id") String id,
                                                               @RequestHeader("token") String token);

    /**
     * @Description: 查询所有二级信息
     * @author zhuliang
     * @date 2020/11/30 21:38
     */
    @ApiOperation(value = "查询所有二级信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", name = "categoryNumber", value = "一级编码", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @GetMapping("smartleasing/currency/getTwoAll/{categoryNumber}")
    public Result<List<CcmsSmartleasingBasicdata>> getTwoAll(@PathVariable(value = "categoryNumber") String categoryNumber,
                                                             @RequestHeader("token") String token);

    /**
     * @Description: 根据编码查询所有一级信息
     * @author zhuliang
     * @date 2020/12/1 9:57
     */
    @ApiOperation(value = "根据编码查询所有一级信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", name = "categoryNumber", value = "一级编码", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @GetMapping("smartleasing/currency/getOneAll/{categoryNumber}")
    public Result<List<CcmsSmartleasingBasicdata>> getOneAll(@PathVariable(value = "categoryNumber") String categoryNumber,
                                                             @RequestHeader("token") String token);

    /**
     * @Description: 根据流水号查询开票信息
     * @author zhuliang
     * @date 2020/12/9 10:30
     */
    @ApiOperation(value = "根据流水号查询开票信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", name = "serialNumber", value = "开票流水号", required = true, dataType = "String")
    })
    @GetMapping("smartleasing/currency/getInvoicingBySerialNumber/{serialNumber}")
    public Result<String> getInvoicingBySerialNumber(@PathVariable("serialNumber") String serialNumber);

    /**
     * @Description: 根据订单号查询开票信息
     * @author zhuliang
     * @date 2020/12/9 10:30
     */
    @ApiOperation(value = "根据订单号查询开票信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", name = "orderNumber", value = "开票订单号", required = true, dataType = "String")
    })
    @GetMapping("smartleasing/currency/getInvoicingByOrderNumber/{orderNumber}")
    public Result<String> byOrderNumber(@PathVariable("orderNumber") String orderNumber);

    /**
     * @Description: 云丁回调接口
     * @author zhuliang
     * @date 2020/12/23 16:29
     */
    @ApiOperation(value = "云丁回调接口")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "yundingCallback", value = "云丁返回值实体类", required = true, dataType = "YundingCallback")
    })
    @PostMapping("smartleasing/currency/getYundingData")
    public Result getYundingData(@RequestBody YundingCallback yundingCallback);

    /**
     * @Description: 绿米消息回调接口
     * @author zhuliang
     * @date 2021/1/8 15:18
     */
    @ApiOperation(value = "绿米消息回调接口")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "greenRiceCallback", value = "绿米返回值实体类", required = true, dataType = "GreenRiceCallback")
    })
    @RequestMapping("smartleasing/currency/getGreenRiceData")
    public Object getGreenRiceData(@RequestBody GreenRiceCallback greenRiceCallback);

    /**
     * @Description: 读取指定目录的xlsx文件，生成房间数据
     * @author zhuliang
     * @date 2021/1/25 16:21
     */
    @ApiOperation(value = "读取指定目录的xlsx文件，生成房间数据")
    @GetMapping("smartleasing/currency/addRoomByExcel")
    public Result addRoomByExcel(@RequestParam String url);


}
